<?php $this->load->view('header'); ?>
<div id="content">
<div class="column full">
		
		<div class="box">
		<div class="box-header"><?php echo get_title();?></div>
		<div class="box-content">

		<?php echo isAccess('myuser','group','view') ? anchor('myuser/group/view', $this->lang->line ( 'myuser_group_view' ), 'class="button white fl"') : ''; ?>
		<div class="clear"></div>

        	<a name="top"></a>
			<div id="cms_status" style="display:none"></div>
			<?php if (isset($errorMessage)) : ?>
            <div class="notification <?php echo ((isset($isSuccess) && $isSuccess) ? 'success' : 'error');?>"><?php echo $errorMessage; ?></div>
	        <?php endif; ?>

			<?php echo form_open('myuser/group/add/time/' . time(),array('name'=>'groupAdd','id'=>'groupAdd','method'=>'post','class'=>'frModalLoad')); ?>
            <?php echo form_hidden('kirim','kirim');?>

			<?php /* ?>
			<div class="width10 fl">
			<label class="form-label"><?php echo $this->lang->line('myuser_group_parent');?></label>
			</div>
			<div class="width90 fr">
				<select name='parent' id='parent'>
                    <option value='0'>Pilih Parent</option>
                    <?php foreach ($groupList as $k=>$v) : ?>
                    	<option value='<?php echo $v['groupId']?>' <?php if ($v['groupId'] == get_data($_POST,'parent') ):?> selected="selected"<?php endif;?> ><?php echo sprintf("%+'-".($v['level'] * 4)."s",  ' ').$v['groupName']?></option>
                    <?php endforeach;?>
                </select>
			</div>
			<p>&nbsp;</p> 
			<div class="clear"></div>
			<?php */ ?>

			<div class="width10 fl">
			<label class="form-label"><?php echo $this->lang->line('myuser_group_parent');?></label>
			</div>
			<div class="width90 fr">
				<?php $sParent=false?>
				<select name='parent' id='parent'>
                    <option value=''>Pilih Group</option>
                    <?php foreach ($groupList as $k=>$v) : ?>
                    	<option value='<?php echo $v['groupId']?>' <?php if ($v['groupId'] == get_data($_POST,'parent') ): $sParent=true;?> selected="selected"<?php endif;?> ><?php echo $v['groupName']?></option>
                    <?php endforeach;?>
                </select>
			</div>
			<p>&nbsp;</p> 
			<div class="clear"></div>
			
			<?php if($sParent):?>
			<div class="width10 fl">
			<label class="form-label">&nbsp;</label>
			</div>
			<div class="width90 fr">
				<?php $sParent2=false?>
				<select name='parent2' id='parent2'>
                    <option value=''>Pilih Group</option>
                    <?php foreach ($groupList2 as $k=>$v) : ?>
                    	<option value='<?php echo $v['groupId']?>' <?php if ($v['groupId'] == get_data($_POST,'parent2') ): $sParent2=true;?> selected="selected"<?php endif;?> ><?php echo $v['groupName']?></option>
                    <?php endforeach;?>
                </select>
			</div>
			<p>&nbsp;</p> 
			<div class="clear"></div>
			
				<?php if($sParent2):?>
				<div class="width10 fl">
				<label class="form-label">&nbsp;</label>
				</div>
				<div class="width90 fr">
					<?php $sParent3=false?>
					<select name='parent3' id='parent3'>
	                    <option value=''>Pilih Group</option>
	                    <?php foreach ($groupList3 as $k=>$v) : ?>
	                    	<option value='<?php echo $v['groupId']?>' <?php if ($v['groupId'] == get_data($_POST,'parent3') ): $sParent3=true?> selected="selected"<?php endif;?> ><?php echo $v['groupName']?></option>
	                    <?php endforeach;?>
	                </select>
				</div>
				<p>&nbsp;</p> 
				<div class="clear"></div>
				
					<?php if($sParent3):?>
					<div class="width10 fl">
					<label class="form-label">&nbsp;</label>
					</div>
					<div class="width90 fr">
						<select name='parent4' id='parent4'>
		                    <option value=''>Pilih Group</option>
		                    <?php foreach ($groupList4 as $k=>$v) : ?>
		                    	<option value='<?php echo $v['groupId']?>' <?php if ($v['groupId'] == get_data($_POST,'parent4') ):?> selected="selected"<?php endif;?> ><?php echo $v['groupName']?></option>
		                    <?php endforeach;?>
		                </select>
					</div>
					<p>&nbsp;</p> 
					<div class="clear"></div>
					<?php endif?>
				
				<?php endif?>
			
			<?php endif?>

			<div class="width10 fl">
			<label class="form-label"><?php echo $this->lang->line('myuser_group_title');?></label>
			</div>
			<div class="width90 fr">
				<?php echo form_input(array('name'=>'title','id'=>'title','value'=>get_data($_POST,'title'), 'class'=> 'form-field half small', 'size' => '20')); ?>
			</div>
			<p>&nbsp;</p> 
			<div class="clear"></div>
			<!-- New line -->


			<div class="width10 fl">
			<label class="form-label"><?php echo $this->lang->line('myuser_group_desc');?></label>
			</div>
			<div class="width90 fr">
			 <?php echo form_input(array('name'=>'desc','id'=>'desc','value'=>get_data($_POST,'desc'), 'class'=> 'form-field half small', 'size' => '20' )); ?>
			 </div>
			
			<div class="clear"></div>
			<input type="submit" name="tblSubmit" value="<?php echo $this->lang->line('global_submit');?>" class="button themed" />
			</form>
		</div>
		</div>
	
	</div>

<script type="text/javascript">
<!--
jQuery(document).ready(function($){
    formChange = function() {
		$('#groupAdd').submit();
    };
    $('select[name=parent]').bind('change',formChange);
    $('select[name=parent2]').bind('change',formChange);
    $('select[name=parent3]').bind('change',formChange);
});
//-->
</script>
<?php $this->load->view('footer'); ?>